import Vue from 'vue'
import Vuex from 'vuex'
import * as actions from './actions'
import * as getters from './getters'

Vue.use(Vuex)

// 应用初始状态
const state = {
    //---------------------------------------------------------------------------------------------------------------------=======================-ckd接口
    //是否需要刷新血透方案列表,设置为true会触发刷新事件
    isNeedLoadPatientDataList: false,
    //历史用药记录刷新
    isNeedLoadHistoryDrugs: false,
    //刷新患者信息
    isNeedLoadPatientData:false,
    //分页后刷新表格
    isNeedLoadCurrentPage: false,
    //待编辑的血透方案数据
    patientDataListPendingEditData: "",
    //当前详情页面患者Id
    currentPatientId:"",
    //是否需要刷新治疗方案列表,设置为true会触发刷新事件
    isNeedLoadMedicationList: false,
    //待编辑的治疗方案数据
    medicationPlanPendingEditData: "",
    //新建患者流程状态
    patientStatus: 0,
    //新建订单流程
    orderStatus : 0,
    //测试数据
    count: 0,
    //--------------------------------------------------------------------------------------------------------------------------=======================-ckd接口

}

// 定义所需的 mutations
const mutations = {
    //---------------------------------------------------------------------------------------------------------------------------=======================-ckd接口
    INCREMENT(state, n) {state.count += n;},
    DECREMENT(state) {state.count--},
    setIsNeedLoadPatientDataList(state, status) {state.isNeedLoadPatientDataList = status; },
    setIsNeedLoadHistoryDrugs(state, status) {state.isNeedLoadHistoryDrugs= status; },
    setIsNeedLoadPatientData(state, status) {state.isNeedLoadPatientData= status; },
    setIsNeedLoadCurrentPage(state, status) {state.isNeedLoadCurrentPage= status; },//分页
    setPatientDataListPendingEditData(state, data) {state.patientDataListPendingEditData = data;},
    setCurrentPatientId(state, status) {state.currentPatientId = status; },
    setIsNeedLoadMedicationList(state, status) {state.isNeedLoadMedicationList = status;},
    setPatientStatus(state, data) {state.patientStatus = data;},
    setOrderStatus(state, data) {state.setOrderStatus = data;},
    //-------------------------------------------------------------------------------------------------------------------------=======================-ckd接口
}

// 创建 store 实例
export default new Vuex.Store({
    actions,
    getters,
    state,
    mutations
})

